/*
 * Copyright (c) 2024 iSOFT INFRASTRUCTURE SOFTWARE CO., LTD.
 * easyAda is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */

#ifndef __GIC_V2_H__
#define __GIC_V2_H__

#ifndef NULL
#define NULL 0
#endif

#ifndef bitmask
#define bitmask(x) (1ul << (x))
#endif

#ifndef lowbitsmask
#define lowbitsmask(x) (bitmask(x) - 1ul)
#endif

typedef unsigned char  uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int   uint32_t;

int gicv2_driver_init(void);

void     gicd_init(void);
void     gicd1_init(void);
void     gicc_init(void);
void     gic_sgi_trigger(unsigned int id, int security, unsigned int filter, unsigned char cpulist);
void     arm_gic_end_of_interrupt(uint32_t cpu, uint32_t id);
uint32_t arm_gic_acknowledge_interrupt(void);
void     gicv2_int_enable(uint32_t irqn);
void     gicv2_int_disable(uint32_t irqn);

#endif
